home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / QuickDraw / Bitblitz 1.0 / LibHeaders / AlrtDlogTools.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-16  |  10.1 KB  |  323 lines  |  [TEXT/KAHL]

  1. /*---------------------------------------------------------------------------------------
  2. //    File:        AlrtDlogTools.h    
  3. //    Date:        February 20, 1989
  4. //
  5. //    By Mike Puckett, Macintosh CPU Software Quality, x4-1332.
  6. //    © 1989 - 1990, Apple Computer, Inc.
  7. //---------------------------------------------------------------------------------------
  8. */
  9. #ifndef __ADTOOLS__
  10. #define __ADTOOLS__ 1
  11.  
  12. #ifndef __MAINUTILS__
  13.     #include "MainUtils.h"        /* For EvtHndlrProcPtr definition.                    */
  14. #endif
  15.  
  16. #ifndef __WCENTER__
  17.     #include "WCenter.h"        /* For CenteringProcPtr definition.                    */
  18. #endif
  19.  
  20. #ifdef THINK_C
  21. #define cancel        Cancel
  22. #define ok            OK
  23. #endif
  24.  
  25. /* Useful Definitions ------------------------------------------------------------------
  26. */
  27. #define decimalOnly    false        /* For use with EditNumText(), GetNumEditText().    */
  28. #define hexDecimal    true
  29.  
  30. #ifndef THINK_C
  31.     typedef pascal Boolean (* ValidTextProcPtr)(DialogPtr theDialog, short theItem);
  32. #else
  33.     typedef ValidTextProc ProcPtr;
  34. #endif
  35.  
  36. #define okayOnly    false        /* For use with DoXAlert().                            */                    
  37. #define okayCancel    true
  38.  
  39. #define noAbort        true        /* For use with SaveChanges().                        */
  40. #define fullClose    false
  41.  
  42. typedef struct                    /* (Dialog)Item Type.                                */
  43. {    Handle    itemHandle;
  44.     Rect    itemRect;
  45.     char    itemType,
  46.             data[];                /* data[0] is length of data array.                    */
  47.     }
  48.  IType,
  49. *ITPtr;
  50.  
  51. typedef struct                    /* (Dialog)Item List.                                */
  52. {    short    numItems;
  53.     IType    item[];                /* Array of ITypes.                                    */
  54.     }
  55.   IList,
  56.  *ILPtr,
  57. **ILHandle;
  58.  
  59. typedef struct                    /* For use with Append/RemoveDITL()                    */
  60. {    DialogTHndl    origDLOG,
  61.                 addDLOG;
  62.     ILHandle    origDITL,
  63.                 addDITL;
  64.     }
  65.   ApndInfo,
  66.  *ApndPtr,
  67. **ApndHandle;
  68.  
  69. /*
  70.     CloseType is the three-state mechanism used to return a response from the
  71.     standard “Do you want to make changes to xxx?” close dialog box.
  72.     
  73.     Note:  These were originally named: yes, abort, no, but abort is defined
  74.            in the StdLib.h file.  Oh, well.  
  75. */
  76. #define closeDlog        (short)1908        /* For use with Save[W]Changes().    */
  77.  
  78. enum
  79. {    closeYes = 1,
  80.     closeCancel,
  81.     closeNo
  82.     };
  83. typedef short CloseType;
  84.  
  85. #define alterSCMsgFlag    "\pSaveChanges"
  86. #define alterSCFIndex    0
  87. #define alterSCMIndex    1
  88. #define ALTERSCMSG(m)    ParamText(alterSCMsgFlag,m,emptyString,emptyString)
  89.  
  90.  
  91. /*
  92.     The following string is used to HandleOkayCancel that it is dealing with
  93.     SFGetFile, which uses item #3 as the cancel button (bozos!).
  94.     
  95.     This string should be set in the sf1stOpen part of the GetDlgHook routine.
  96. */
  97. #define SFGetTitle        "\pSFG"
  98. #define SFPutTitle        "\pSFP"
  99. #define noArrow            "\pNoA"
  100. #define noTextMod        "\pNoTM"
  101.  
  102. /* SFParams is a data structue that encapsulates the two low-memory globals,
  103. // SFSaveDisk and CurDirStore, which are responsible for displaying SFPutFile
  104. // and SFGetFile volumes and directories.
  105. */
  106. typedef struct                            /* For use with StdPut/GetDialog().    */
  107. {    short    sfSaveDisk;                    /* This is the vRefNum (not minus).    */
  108.     long    curDirStore;
  109.     }
  110.  SFParams,
  111. *SFParamsPtr;
  112.  
  113. #define creatorRsrc        '**ct'            /* For use with SFPSelectCreator(). */
  114. #define sfpPutCreatorID    (short)2050        /* These numbers are really in the    */
  115. #define sfpEdtCreaotrID    (short)2052        /*        LogFile range, oh well.        */
  116.  
  117. #define aboutLibDlogID    (short)1877        /* For use with StdLibAboutDlog().    */
  118.  
  119. #define gnrlStrs        (short)1836        /* Various strings.                    */
  120. #define gsStop            1
  121. #define gsContinue        2
  122.  
  123. #define ptSet            "\ptSet"        /* ParamText set for DoIndErr().    */
  124.  
  125. #define gnrlAlert        (short)1876        /* For use with DoIndErr/StrAlert()    */
  126.  
  127. #define stopErrs        (gnrlAlert+stopIcon)
  128. #define stopChoosePr    1
  129.  
  130. #define noteErrs        (gnrlAlert+noteIcon)
  131. #define noteWrongSys    (short)1
  132. #define noteInitErr        (short)2
  133. #define noteNotEnufMem    (short)3
  134. #define noteFSErr        (short)4
  135. #define notePrErr        (short)5
  136.  
  137. #define cautionErrs        (gnrlAlert+cautionIcon)
  138. #define cautionDAMemErr    (short)1
  139. #define cautionDAResErr    (short)2
  140.  
  141. #ifdef __safe_link
  142. extern "C" {
  143. #endif
  144.  
  145. extern pascal void                InitAlrtDlogTools(            EvtHndlrProcPtr        eventHandler);
  146.  
  147.  
  148. /* Dialog-Item Maninpulation Routines --------------------------------------------------
  149. */
  150. extern pascal short                GetNumDITLItems(            short                rsrcID);
  151.  
  152. extern pascal void                GetDITLString(                short                rsrcID,
  153.                                                             short                itemNumber,
  154.                                                             char                *theString);
  155.  
  156. extern pascal void                UpdtDItem(                    DialogPtr            theDialog,
  157.                                                             short                theItem);
  158.                                                             
  159. extern pascal void                SetDItemTxt(                DialogPtr            theDialog,
  160.                                                             short                theItem,
  161.                                                             char                *theText);
  162. extern pascal void                GetDItemTxt(                DialogPtr            theDialog,
  163.                                                             short                theItem,
  164.                                                             char                *theText);
  165.                                                             
  166. extern pascal void                SetDItemCtlValue(            DialogPtr            theDialog,
  167.                                                             short                theItem,
  168.                                                             short                theValue);
  169. extern pascal short                GetDItemCtlValue(            DialogPtr            theDialog,
  170.                                                             short                theItem);
  171.                                                             
  172. extern pascal void                SetDItemCTitle(                DialogPtr            theDialog,
  173.                                                             short                theItem,
  174.                                                             char                *theTitle);
  175. extern pascal void                GetDItemCTitle(                DialogPtr            theDialog,
  176.                                                             short                theItem,
  177.                                                             char                 *theTitle);
  178.                                                             
  179. extern pascal ControlHandle        GetDItemCtlHandle(            DialogPtr            theDialog,
  180.                                                             short                theItem);
  181.  
  182. extern pascal unsigned short    GetDItemHiliteState(        DialogPtr            theDialog,
  183.                                                             short                theItem);
  184.  
  185. extern pascal Boolean            DoHiliteControl(            DialogPtr            theDialog,
  186.                                                             short                theItem,
  187.                                                             short                thePart);
  188.                                     
  189. extern pascal void                SetControlHilite(            DialogPtr            theDialog,
  190.                                                             short                theItem,
  191.                                                             short                theHilite);
  192.         
  193. extern pascal void                HandleRadioButtons(            DialogPtr            theDialog,
  194.                                                             short                startItem,
  195.                                                             short                stopItem,
  196.                                                             short                setItem);
  197.                                                     
  198. extern pascal Boolean            ToggleCheckBox(                DialogPtr            theDialog,
  199.                                                             short                checkItem,
  200.                                                             Boolean                oldValue);
  201.         
  202. extern pascal void                SetupUserItem(                DialogPtr            theDialog,
  203.                                                             short                theItem,
  204.                                                             ProcPtr                drawProc);                                                
  205. extern pascal void                SetupUserItems(                DialogPtr            theDialog,
  206.                                                             short                uiStart,
  207.                                                             short                uiStop,
  208.                                                             ProcPtr                drawProc);
  209.                                                             
  210. extern pascal void                IBeamCursorAdjust(            DialogPtr            theDialog,
  211.                                                             ValidTextProcPtr    validProc);
  212.  
  213. extern pascal void                HandleScrap(                DialogPtr            theDialog,
  214.                                                             EventRecord            *theEvent);
  215.  
  216. extern pascal void                DeleteLeadingPeriods(        DialogPtr            theDialog,
  217.                                                             short                textItem);
  218.  
  219. extern pascal Boolean            HandleOkayCancel(            DialogPtr            theDialog,
  220.                                                             EventRecord            *theEvent,
  221.                                                             short                *itemHit);
  222.                                                         
  223. extern pascal Boolean            EditStrText(                DialogPtr            theDialog,
  224.                                                             EventRecord            *theEvent,
  225.                                                             short                editItem,
  226.                                                             short                maxSizeStr,
  227.                                                             char                *excludeChars);
  228.  
  229. extern pascal Boolean            StdValidDecTextProc(        DialogPtr            theDialog,
  230.                                                             short                theItem);
  231.                                                             
  232.  
  233. extern pascal Boolean            EditNumText(                DialogPtr            theDialog,
  234.                                                             EventRecord            *theEvent,
  235.                                                             short                editItem,
  236.                                                             long                minValue,
  237.                                                             long                maxValue,
  238.                                                             Boolean                allowHex);
  239. extern pascal long                GetNumEditText(                DialogPtr            theDialog,
  240.                                                             short                editItem,
  241.                                                             Boolean                allowHex);
  242.                                                         
  243. extern pascal void                StdDlogActivate(            DialogPtr            theDialog,
  244.                                                             EventRecord            *theEvent);
  245. extern pascal void                StdDlogUpdate(                DialogPtr            theDialog,
  246.                                                             EventRecord            *theEvent);
  247. extern pascal Boolean            StdDlogFilter(                DialogPtr            theDialog,
  248.                                                             EventRecord            *theEvent,
  249.                                                             short                *itemHit);
  250.                                                     
  251. extern pascal ApndHandle        AppendDITL(                    ResType                resType,
  252.                                                             short                theDialog,
  253.                                                             short                addDialog);
  254. extern pascal void                RemoveDITL(                    ApndHandle            apndHandle);
  255.  
  256. /* Dialogs ---------------------------------------------------------------------------
  257. */
  258. extern pascal short                DoStrAlert(                    short                alertType,
  259.                                                             short                alertID,
  260.                                                             char                *str0,
  261.                                                             char                *str1,
  262.                                                             char                *str2,
  263.                                                             char                *str3,
  264.                                                             Boolean                showCancel,
  265.                                                             char                *okayName,
  266.                                                             char                *cancelName);
  267.                                                                                                                     
  268. extern pascal short                DoIndErrAlert(                short                alertType,
  269.                                                             short                alertID,
  270.                                                             short                messageIndex,
  271.                                                             long                errorValue,
  272.                                                             Boolean                showCancel);
  273.                                                         
  274. extern pascal CloseType            SaveWChanges(                char                *wName,
  275.                                                             char                *actionType,
  276.                                                             short                dlogID,
  277.                                                             Boolean                cantAbort);
  278.                                                             
  279. extern pascal CloseType            SaveChanges(                char                *message,
  280.                                                             Boolean                cantAbort,
  281.                                                             CenteringProcPtr    centeringProc,
  282.                                                             short                constraint);
  283.  
  284. extern pascal short                StdSFPutHook(                short                theItem,
  285.                                                             DialogPtr            theDialog);
  286. extern pascal void                StdSFPutDialog(                char                *promptStr,
  287.                                                             char                *origStr,
  288.                                                             SFReply                *sfReply,
  289.                                                             SFParams            *sfParams,
  290.                                                             CenteringProcPtr    centeringProc,
  291.                                                             short                constraint);
  292.                                                             
  293. extern pascal short                StdSFGetHook(                short                theItem,
  294.                                                             DialogPtr            theDialog);
  295. extern pascal void                StdSFGetDialog(                short                numTypes,
  296.                                                             SFTypeList            typeList,
  297.                                                             ProcPtr                fileFilter,
  298.                                                             SFReply                *sfReply,
  299.                                                             SFParams            *sfParams,
  300.                                                             CenteringProcPtr    centeringProc,
  301.                                                             short                constraint);
  302.  
  303. extern pascal void                SFPSelectCreator(            short                putCreatorID,
  304.                                                             short                otherDlogID,
  305.                                                             ResType                *defaultCreator,
  306.                                                             char                *promptStr,
  307.                                                             char                *origStr,
  308.                                                             SFReply                *sfReply,
  309.                                                             SFParams            *sfParams);
  310.                                                         
  311. extern pascal void                AddCreator(                                        void);
  312.  
  313.  
  314. extern pascal void                StdLibAboutDlog(            char                *libName,
  315.                                                             char                *versStr,
  316.                                                             short                dlogID,
  317.                                                             WindowPtr            parentWindow);
  318.  
  319. #ifdef __safe_link
  320. }
  321. #endif
  322.  
  323. #endif